{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import tkinter as tk"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "window = tk.Tk()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "''"
      ]
     },
     "execution_count": 23,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "window.title(\"my window\")\n",
    "window.geometry(\"200x200\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [],
   "source": [
    "var1 = tk.StringVar()\n",
    "l = tk.Label(window, bg=\"yellow\", width=4, textvariable=var1)\n",
    "l.pack()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def insert_point():\n",
    "    value = lb.get(lb.curselection())\n",
    "    var1.set(value)\n",
    "    \n",
    "b1 = tk.Button(window, text=\"selection\", command=insert_point)\n",
    "b1.pack()\n",
    "\n",
    "var2 = tk.StringVar()\n",
    "var2.set([11, 22, 33, 44])\n",
    "\n",
    "lb = tk.Listbox(window, listvariable=var2)\n",
    "list_items = [1, 2, 3, 4]\n",
    "\n",
    "for item in list_items:\n",
    "    lb.insert(\"end\", item)\n",
    "lb.pack()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [],
   "source": [
    "window.mainloop()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
